{extend name="public:base" /}
{block name="head"}
<link href="__PUBLIC__/view_res/mobile/css/wshop_companyreg.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/css/jquery-weui.min.css" type="text/css" rel="Stylesheet" />
<script src="__PUBLIC__/jquery-weui/dist/js/jquery-weui.min.js"></script>
{/block} 

{block name="header"}
{include file="public/top-nav" /}
{/block}

{block name="content"}   

<!-- from -->
<form id="login-wrap">
  

    <header class="Thead">您的登录密码</header>
    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="password" name="password" value=""  tabindex="2" placeholder="请输入您的登录密码" />
        </div>
    </div>

    <header class="Thead">新二级密码</header>
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="password" name="2password" value=""  tabindex="3" placeholder="请输入新的二级密码" />
        </div>
    </div>

    <header class="Thead">确认新二级密码</header>
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="password" name="2pwd2" value="" tabindex="4" placeholder="再次输入新二级的密码" />
        </div>
    </div>
    <header class="Thead">短信验证码</header>
    <div style="padding:0 10px;">
        <div class="gs-text">
            <input type="text" name="code" id="code" value="" tabindex="4" placeholder="请输入收到的短信验证码" />
        </div>
        <div class="weui_cell_hd">
	                <input type="button" id="btn" style="border-radius: 5px;height: 35px" class="am-btn am-btn-danger" onclick="send2pwd()" value="获取验证码" />
	            </div>  
    </div>

</form>

<a class="button green" href="javascript:;" id="reg-btn">确认修改</a>


{/block}
{block name="script"}
<script>
$('#reg-btn').click(function(){
	$.post(
		
			'{:url("user/updateuser2passwd")}',	
		
		$('input[type="password"],input[type="text"],input[type="hidden"]'),
		function(d){
			if(d.error){
				$.toast(d.error, "forbidden");
			}else if(d.success){
				$.toast(d.success);
				
				setTimeout(function (){
			      history.go(-1);
			    },2000);
			}
		}
	);
});


var wait=60*2;
document.getElementById("btn").disabled = false;
function time(o) {
    if (wait == 0) {
      o.removeAttribute("disabled");
      o.value="免费获取验证码";
      wait = 60;
    } else {
      o.setAttribute("disabled", true);
      o.value="重新发送(" + wait + ")";
      wait--;
      setTimeout(function() {
        time(o)
      },
      1000)
    }
  }

function send2pwd(){
        var i=60;
		var wait=60;
                    //var phone=document.getElementById("mobile").val;
		var phone = $("#code").val();
		//alert(phone);

		document.getElementById("btn").disabled = false;
		$.post("/mobile/login/send2pwd",{mobile:encodeURIComponent($("#code").val())},
						function(d){
						   //layer.msg(d.info);
								
							time(document.getElementById("btn"));

						});


    }
</script>
{/block}